﻿<#
	File      = ConvertTo-Type.ps1
	Author    = Kirk "Poshoholic" Munro
	Publisher = Poshoholic Studios
	Copyright = © 2012 Poshoholic Studios. All rights reserved.
#>

function ConvertTo-Type {
	[CmdletBinding()]
	param(
		[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
		[ValidateNotNullOrEmpty()]
		[System.Management.CimType]
		$CimType
	)
	switch ($CimType) {
		([System.Management.CimType]::None) {
			[System.Void]
			break
		}
		([System.Management.CimType]::SInt8) {
			[System.SByte]
			break
		}
		([System.Management.CimType]::SInt16) {
			[System.Int16]
			break
		}
		([System.Management.CimType]::SInt32) {
			[System.Int32]
			break
		}
		([System.Management.CimType]::SInt64) {
			[System.Int64]
			break
		}
		([System.Management.CimType]::UInt8) {
			[System.Byte]
			break
		}
		([System.Management.CimType]::UInt16) {
			[System.UInt16]
			break
		}
		([System.Management.CimType]::UInt32) {
			[System.UInt32]
			break
		}
		([System.Management.CimType]::UInt64) {
			[System.UInt64]
			break
		}
		([System.Management.CimType]::Real32) {
			[System.Single]
			break
		}
		([System.Management.CimType]::Real64) {
			[System.Double]
			break
		}
		([System.Management.CimType]::Char16) {
			[System.Char]
			break
		}
		([System.Management.CimType]::String) {
			[System.String]
			break
		}
		([System.Management.CimType]::Boolean) {
			[System.Boolean]
			break
		}
		([System.Management.CimType]::DateTime) {
			[System.DateTime]
			break
		}
		([System.Management.CimType]::Object) {
			[System.Management.ManagementObject]
			break
		}
		([System.Management.CimType]::Reference) {
			[System.Management.Automation.PSReference]
			break
		}
	}
}	